def is_float(text):
    try:
        float(text)
        return True
    except ValueError:
        return False
def while_input(tip, fun, param=None):
    while True:
        try:
            res = input(tip)
            if fun is None:
                return res
            if param is None:
                if fun(res):
                    return res
                else:
                    print('输入有误，请重新输入')
            else:
                if fun(res, param):
                    return res
                else:
                    print('输入有误，请重新输入')
        except Exception as e:
            print(f"{e}")
            print('输入有误，请重新输入')
def is_int_between(text, param):
    # 两边都是闭区间
    try:
        return param[0] <= int(text) <= param[1]
    except ValueError:
        return False
def input_is_yes(text) -> bool:
    s = input(f"{text} Y/y/yes[enter] N/n/not/<Any key>:")
    return s.lower() == 'y' or s.lower() == 'yes' or s == ''
def is_int(text):
    try:
        int(text)
        return True
    except ValueError:
        return False


